import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

// 获取所有module
const files = require.context("./modules", false, /\.js$/);
const modules = {};
files.keys().forEach(key => {
  modules[key.replace(/(\.\/|\.js)/g, "")] = files(key).default;
});

const debug = process.env.NODE_ENV !== "production";

export default new Vuex.Store({
  modules,
  strict: debug
});
